var express = require('express');
var api = express();
const Mock = require('mockjs')

let usersListData = Mock.mock({
  'data|80-100': [
    {
      id: '@id',
      name: '@name',
      'idUser|+1': 1001,
      nickName: '@last',
      phone: /^1[34578]\d{9}$/,
      'age|11-99': 1,
      mobile: /^1[3-9][0-9]{9}$/,
      'sex|0-2': 1,
      note: '@city',
      'remark|1': ['今天很累了', '今天不怎么想说话了'],
      address: '@county(true)',
      isMale: '@boolean',
      email: '@email',
      createTime: new Date().getTime(),
    },
  ],
})

let database = usersListData.data

api.post('/test', async function (req, res, next) {
  res.send({
    code: 200,
    msg: 'success',
    obj: database
  })
});

module.exports = api;